<script lang="ts" setup>
import { ref } from "vue";
import { Popup } from "vant";
import { useI18n } from "vue-i18n";
const overlayShow = ref(false);
const { t } = useI18n();
const setSidebar = () => {
  overlayShow.value = true;
};
const closeSidebar = () => {
  overlayShow.value = false;
};
defineExpose({ setSidebar, closeSidebar });
defineProps<{
  messageContent?: any;
}>();
</script>
<template>
  <!-- 消息的底部栏 -->
  <div>
    <Popup
      v-model:show="overlayShow"
      position="bottom"
      :lock-scroll="true"
      :safe-area-inset-top="true"
      :safe-area-inset-bottom="true"
      :style="{
        position: 'absolute',
        width: '100%',
        height: '100%',
        backgroundColor: 'rgba(0, 0, 0, 0.1)',
      }"
      duration="0.2"
      z-index="510"
      @click.self="overlayShow = false"
    >
      <div class="sider-frame">
        <div class="sider-popupt"></div>
        <div class="content-frame">
          <div class="common-hdialog-title">
            {{ t("systemNotify.systemNews") }}
            <img class="user-img" src="@/image/new_img/home/Close_bai.png" @click="closeSidebar" />
          </div>
          <div class="hdialog-noty-content-icon">
            <img class="directory-img" src="@/image/new_img/home/xiaoxi_zi.png" />
          </div>
          <div class="hdialog-noty-content-text">
            <div class="hdialog-noty-frame" v-for="(item, index) in messageContent" :key="index">
              {{ item.content }}
            </div>
          </div>
          <div class="hdialog-noty-content-btn">
            <img
              class="directory-img"
              src="@/image/new_img/home/complete.png"
              @click="closeSidebar"
            />
          </div>
        </div>
      </div>
    </Popup>
  </div>
</template>
<style lang="less" scoped>
/deep/ .van-popup {
  background-color: transparent; /* 将背景色设置为透明 */
}
.sider-frame {
  position: relative;
  left: 0;
  top: 0;
  height: 100%;
  height: 100%;
}
.sider-popupt {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 10;
  width: 100%;
  height: 100%;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  background: rgba(0, 0, 0, 0.5) !important;
}
.content-frame {
  width: 100%;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 20;
  overflow-y: scroll;
  background: rgba(0, 0, 0, 0.5);
  .common-hdialog-title {
    position: relative;
    left: 0rem;
    width: 10rem;
    height: 1.5rem;
    text-align: center;
    font-size: 0.533rem;
    line-height: 1.7rem;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 1);
    img {
      position: absolute;
      top: 50%;
      margin-top: -0.2rem;
      right: 0.53rem;
      width: 0.6rem;
      height: 0.6rem;
    }
  }
  .hdialog-noty-content-icon {
    height: 3.36rem;
    display: flex;
    justify-content: center;
    align-items: center;
    img {
      width: 132px;
      height: 132px;
    }
  }
  .hdialog-noty-content-text {
    max-height: 40vh;
    overflow-y: scroll;
    margin-left: 1rem;
    margin-right: 1rem;
    font-size: 0.373rem;
    line-height: 0.55rem;
    text-align: left;
    word-wrap: break-word;
    white-space: pre-wrap;
    color: rgba(255, 255, 255, 0.65);
  }
  .hdialog-noty-content-text::-webkit-scrollbar {
    display: none;
    overflow: -moz-scrollbars-none; /* Firefox */
    -ms-overflow-style: none; /* IE 和 Edge */
  }
  .hdialog-noty-content-btn {
    width: 100%;
    position: absolute;
    bottom: 4rem;
    display: flex;
    justify-content: center;
    align-items: center;
    img {
      width: 3.33rem;
      height: 1.33rem;
    }
  }
}
.hdialog-noty-frame {
  font-size: 0.373rem;
  margin-bottom: 20px;
  line-height: 42px;
}
</style>
